<template lang="pug">
  div
    s-table(
      ref="table"
      v-if="$route.name === 'sceneMonitor_hospitalizedScene_dept_personnel'"
      :column="tableObj.column"
      :filterProps="{items: tableObj.filterItems}"
      :queryFn="tableObj.getList"
      rowKey="mdtrtId"
      :queryPropsParams="{deptId: id}"
      :title="title"
      )
      template(slot="action" slot-scope="text, scope")
        el-link(type="primary" :underline="false" @click="$router.push({path: '/sceneMonitor/hospitalizedScene/personnel/recog', query: { id: scope.mdtrtId }})") 认证详情
    router-view(v-else)
</template>
<script>
import { STable } from '@/components'
import { personnelList } from '@/api/sceneMonitor'

const column = [
  {
    prop: 'psnName',
    label: '姓名'
  },
  {
    prop: 'mdtrtNo',
    label: '住院号',
    align: 'center'
  },
  {
    prop: 'admTime',
    label: '入院时间',
    align: 'center'
  },
  {
    prop: 'admRecogStas',
    label: '入院拍照',
    align: 'center'
  },
  {
    prop: 'shouldCnt',
    label: '应查房次数',
    align: 'center'
  },
  {
    prop: 'realityCnt',
    label: '实查房次数',
    align: 'center'
  },
  {
    prop: 'warnStas',
    label: '是否被预警',
    align: 'center'
  },
  {
    prop: 'action',
    label: '操作',
    width: '164',
    align: 'center'
  }
]

export default {
  name: 'PersonnelList',
  components: {
    STable
  },
  data () {
    return {
      tableObj: {
        column,
        getList: personnelList,
        filterItems: [
          {
            key: 'keyword',
            label: '关键信息',
            placeholder: '姓名、住院号'
          },
          {
            key: 'admDate',
            label: '入院时间',
            type: 'date'
          },
          {
            key: 'admRecogStas',
            label: '入院拍照',
            type: 'selectdict',
            dictKey: 'admdvsList'
          }
        ]
      }
    }
  },
  computed: {
    id () {
      return this.$route.query.id || ''
    },
    title () {
      return this.$route.query.title || ''
    }
  },
  created () {
  },
  methods: {
    // 刷新表格
    refreshTable (flag = false) {
      this.$refs.table.refresh(flag)
    }
  }
}
</script>
